#!/bin/bash

# 配置 npm 为国内镜像
npm config set registry https://registry.npm.taobao.org

# 下载 vue 模板
if [ ! -d ~/.vue-templates ]; then
	aria2c https://github.com/vuejs-templates/webpack-simple/archive/master.zip
	mkdir ~/.vue-templates
	unzip webpack-simple-master.zip
	mv webpack-simple-master ~/.vue-templates/webpack
	rm -rf webpack-simple-master webpack-simple-master.zip
fi

# 下载所有所需的包
npm install --save-dev vue-cli

# 初始化项目
npx vue init webpack hello-npm --offline

# 运行项目
cd hello-npm
npm install
npm run dev

